﻿$(function(){//延迟加载
	var dvIds=$('#dvIds').val();
	if(dvIds!=''){
		document.getElementById('jxmap').src="creatjxmap?dvIds="+dvIds;
	}
	$('#dajuxiang').combobox({
		onChange:function(newValue,oldValue){
			if(newValue=='0'){				
				$('#juxiang').combobox({					
					disabled:true
				});
				$('#juxiang').combobox('clear');
				$('#jifang').combobox({
					disabled:true
				});
				$('#jifang').combobox('clear');
			}else{
				$('#jifang').combobox({
					disabled:true
				});
				$('#juxiang').combobox({
					value:'请选择',
					disabled:false,
					valueField: 'jxId',    
			        textField: 'jxname',
					url:"showjx?djxId="+newValue,
				});
			}
		}
	});
	$('#jifang').combobox({
		width:200,
		onChange:function(newValue,oldValue){
			document.getElementById('jxmap').src="creatjxmap?jfId="+newValue;
		}
	});
	$('#juxiang').combobox({
		onChange:function(newValue,oldValue){
			if(newValue=='0'){				
				$('#jifang').combobox({
					disabled:true
				});
				$('#jifang').combobox('clear');
			}else{
				$('#jifang').combobox({
					value:'请选择',
					disabled:false,
					valueField:'jfId',
					textField:'jfname',
					url:'showjf?jxId='+newValue
				})
			}
			//$('#jxmap').src='creatjxmap?jxId='+newValue;
			if(newValue!='0')
			 document.getElementById('jxmap').src="creatjxmap?jxId="+newValue;
		}
	});
	
	$('#ssd').searchbox({
		searcher:function(value,name){
			pbelong=name;
			pip=value;
			if(value==''||name=='0'){
				alert('未输入');
			}else{
				$('#mresult').combobox({
					disabled:false,
					value:'请选择',
					disabled:false,
					valueField: 'parentId',    
			        textField: 'parentname',
					url:"querybyip?dvbelong="+name+"&dvip="+value,
				});
			}
		}, 
		menu:'#mm', 
		prompt:'设备ip..' 					
	}); 
});